package org.aeon.newsmanagersystem.pojo.other;

import lombok.Data;

/**
 * @author: MissingAeon
 * @date: 2024/3/29 8:54
 * @description: 响应对象
 */

@Data
public class Return<T> {
    private String message;
    private Integer code;
    private T data;
    // private Date date;

    public static <T> Return<T> OK(T data) {
        final Return<T> re = new Return<>();
        re.setData(data);
        re.setCode(200);
        re.setMessage("success");
        return re;
    }


    public static <T> Return<T> ERR(Integer code, String message) {
        final Return<T> re = new Return<>();
        re.setCode(code);
        re.setMessage(message);
        return re;
    }
}
